extends StaticBody2D

@export var color : String

@export var locked : bool = true

func _ready():
	if locked:
		get_node("Sprite2D").modulate.a = 1
	else:
		get_node("Sprite2D").modulate.a = 0.5
	get_node("CollisionShape2D").set_deferred("disabled", !locked)

func on_button_toggled(button_color, _button_enabled):
	if button_color == color:
		if locked:
			locked = false
			get_node("Sprite2D").modulate.a = 0.5
		else:
			locked = true
			get_node("Sprite2D").modulate.a = 1
		get_node("CollisionShape2D").set_deferred("disabled", !locked)
